const { connection, query } = require('../model/index');

const test = async (ctx, next) => {
  let { id } = ctx.params;

  let [ rows, fields ] = await query('select * from blog_category where `id` = ?', [1]);


  // ctx.throw(500, {
  //   code: 500,
  //   message: '失败',
  //   errors: '{}',
  // })
  
  // console.log(ctx.request.body)
  // console.log(ctx.request.files)

  console.log(ctx.url.replace(/(^\/\w*)[\/\?].*/gi, '$1'))

  ctx.body = {
    data: rows,
    code: 200,
    id: id
  };
}

module.exports = {
  test
}